<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数组去重</title>
</head>
<body>
    
    <script>
    
Array.prototype. unique3 = function(){
    var res = [];
    var json = {};
    for(var i = 0; i < this.length; i++){
        if(!json[this[i]]){
            res.push(this[i]);
            json[this[i]] = 1;
        }
    }
    return res;
}
       var arr = [111,22,555,111,22,'你好','std','std','你好'];
    alert(arr.unique3());
    console.log(arr.unique3());



// 取100内质数
var prime = function(len){
    var i,j;
    var arr = [];
  for(i = 1; i < len; i++){
    for(j=2; j < i; j++){   
      if(i%j === 0) {
         break;
      }
    }
    if(i <= j && i !=1){ 
      arr.push(i);
    }
   
  }
  return arr;
};
console.log(prime(120));

    </script>
</body>
</html>